'use strict';

const Controller = require('egg').Controller;

class ConsumeController extends Controller {
  async addConsume() {
    let { ctx, service } = this;
    let obj = ctx.request.body;
    let arr = await service.add.addConsume(obj);
    ctx.body = arr
  }

  async getConsume() {
    let { ctx, service } = this;
    let {obj, pageObj} = ctx.request.body;
    let arr = await service.get.getOrder({ orderName: { $regex: obj.orderName } }, pageObj);
    ctx.body = arr
  }

  async upConsume() {
    let { ctx, service } = this;
    console.log(ctx.request.body)
    let arr = await service.update.upOrder(ctx.request.body);
    ctx.body = arr
  }

  async delConsume() {
    let { ctx, service } = this;
    console.log(ctx.request.body)
    let arr = await service.update.delOrder(ctx.request.body);
    ctx.body = arr
  }

}

module.exports = ConsumeController;
